// pages/course/course.js
let app=getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    url:'',
    pageNum:1,
    pageSize:3,
    article:[],
    tu:[],
    id:0
  },
  gotozxkf(){
    wx.navigateTo({
      url: '/pages/index/onlineService/onlineService',
    })
  },
  getTu(){
    wx.request({
      url: this.data.url+'homecarousel/page',
      method:'get',
      data:{
        pageNum:this.data.pageNum,
        pageSize:this.data.pageSize,
      },
      success:resp=>{
        this.setData({
          tu:resp.data.data.list
        })
        // console.log(this.data.tu);
      }
    })
  },
  getArticle(){
    wx.request({
      url: this.data.url+'seleart/page',
      method:'GET',
      data:{
        pageNum:this.data.pageNum,
        pageSize:this.data.pageSize,
        // index:this.data.index
      },
      success:resp=>{
        this.setData({
          article:resp.data.data.list,
        })
        // console.log(this.data.pages);
      }
    })
  },
  gotoSerch(){
    wx.navigateTo({
      url: '/pages/index/indexSerch/indexSerch',
    })
  },
  gotoRep(){
    wx.navigateTo({
      url: '/pages/index/indexRep/indexRep',
    })
  },
  gotoPsyEva(){
    wx.navigateTo({
      url: '/pages/index/indexPsyEva/indexPsyEva'
    })
  },
  gotoCourseApp(){
    wx.navigateTo({
      url: '/pages/index/indexConApp/indexConApp',
    })
  },
  gotoAnswer(){
    wx.navigateTo({
      url: '/pages/index/indexAnswer/indexAnswer',
    })
  },
  gotoPsyKno(){
    wx.navigateTo({
      url: '/pages/index/indexPsyKno/indexPsyKno',
    })
  },
  gotoFm(){
    wx.navigateTo({
      url: '/pages/index/Fm/Fm',
    })
  },
  gotoPublic(){
    wx.navigateTo({
      url: '/pages/index/public/public',
    })
  },
  gotoMore(){
    wx.navigateTo({
      url: '/pages/index/indexMore/indexMore',
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let user = wx.getStorageSync('user')
    this.setData({
      url:app.globalData.url,
      id:options.id
    })
    this.getArticle()
    this.getTu()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})